<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        * {
            box-sizing: border-box;
        }
        body {
            font-family: 'Lato';
            -webkit-font-smoothing: antialiased;
            line-height: 1.5;
            background: #1a1a1a;
        }
        a {
            text-decoration: none;
            color: inherit;
        }
        ul {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
        .project {
            height: 100vh;
            min-width: 100vw;
            overflow: hidden;
            position: relative;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
        }
        .project__list {
            position: relative;
            z-index: 1;
            text-align: center;
            font-size: 36px;
            color: white;
        }
        .project__link {
            will-change: opacity;
            display: block;
            margin: 24px 0;
        }
        .project__bg-list {
            position: absolute;
            top: 0;
            left: 0;
        }
        .project__bg-item {
            will-change: transform, opacity;
            position: absolute;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            opacity: 0;
            -webkit-transform: scale(0.7);
            -ms-transform: scale(0.7);
            transform: scale(0.7);
            -webkit-transition: all 1s cubic-bezier(0.23, 1, 0.32, 1);
            transition: all 1s cubic-bezier(0.23, 1, 0.32, 1);
        }
        .project__bg-item--active {
            opacity: 1;
            -webkit-transform: scale(1);
            -ms-transform: scale(1);
            transform: scale(1);
        }
        .project__bg-item:nth-child(1) {
            background: url("../img/1080-1.jpg") center/cover;
        }
        .project__bg-item:nth-child(2) {
            background: url("../img/1080-2.jpg") center/cover;
        }
        .project__bg-item:nth-child(3) {
            background: url("../img/1080-3.jpg") center/cover;
        }
        .project__bg-item:nth-child(4) {
            /* demo */

            background: url("../img/1080-4.jpg") center/cover;
        }
        main {
            position: absolute;
            bottom: 0;
            color: white;
            padding: 24px;
            opacity: 0.9;
        }
        main h1 {
            font-weight: 300;
            margin: 0 0 12px;
        }
        main p {
            margin: 0;
        }
        main p a {
            font-weight: bold;
        }
    </style>

    <script src="../../js/jquery.js"></script>
</head>
<body>
<div class="project">
    <ul class="project__list">
        <li class="project__item"><a href="" class="project__link">Retro</a>
        </li>
        <li class="project__item"><a href="" class="project__link">Tofu</a>
        </li>
        <li class="project__item"><a href="" class="project__link">Banjo</a>
        </li>
        <li class="project__item"><a href="" class="project__link">Pitchfork</a>
        </li>
    </ul>

    <ul class="project__bg-list">
        <li class="project__bg-item"></li>
        <li class="project__bg-item"></li>
        <li class="project__bg-item"></li>
        <li class="project__bg-item"></li>
    </ul>
</div>
</body>
</html>

<script>
    var project = $('.project');
    var pLink = project.find('.project__link');
    var pBg = project.find('.project__bg-item');

    var changeBg = function() {
        var thisProject = $(this);
        var thisProjectIndex = thisProject.parent().index();
        var thisProjectBg = pBg.eq(thisProjectIndex);

        // hide all backgrounds and fade out project names
        pBg.removeClass('project__bg-item--active');
        pLink.css('opacity', '0.4');

        // reveal the project bg you hovered over and increase opacity for that name
        thisProject.css('opacity', '1');
        thisProjectBg.addClass('project__bg-item--active');
    };

    var showFirst = function() {
        // when the page loads reveal the first project
        pLink.css('opacity', '0.4');
        pLink.parent().first().children().css('opacity', '1');
        pBg.first().addClass('project__bg-item--active');
    }

    var init = function() {
        $(document).on('ready', showFirst);
        pLink.on('mouseenter', changeBg);
    };

    init();
</script>